var member_id = ws = spage = '';
document.addEventListener('plusready',function(){
	member_id = plus.storage.getItem('id');
	ws = plus.webview.currentWebview();
	spage = ws.wsid;
	$('.preservation').on('click',function(){
		var true_name = $('.true_name').val();
		var mob_phone = $('.mob_phone').val();
		var area_info = $('.area_info').val();
		var address = $('.address').val();
		if(!mob_phone.match(p1)){
			toast('请输入正确的联系电话!');return;
		}
		$.ajax({ 
			type:"post", 
			url:apiRoot+"?act=member_address&op=address_add",
			data:{
				address:address,
				area_info:area_info,
				mob_phone:mob_phone,
				true_name:true_name,
				member_id:member_id
			},
			dataType:'json',
			success:function(data){ 
//				console.log(JSON.stringify(data)); 
				if(data.code == 200){
					toast('添加成功！');
					plus.webview.getWebviewById(spage).reload();
					setTimeout(function(){
						ws.close()
					},1000);
				}else{
					toast(data.datas.error);
				}
			}, 
			error:function(e){
				toast('连接失败！');
			}
		});
	})
},false);